package com.engine;

import java.io.FileNotFoundException;
import java.io.IOException;

public class TicketEngine implements Runnable {
	//kelas untuk menghandle connection dari client.
	//menggunkan socket. dan berfungsi sebagai listen.
	private int port;
	private Server server;
	public TicketEngine() throws FileNotFoundException, IOException
	{
		init();
	}
	
	private void init() throws FileNotFoundException, IOException
	{
		ReadConfig.getInstance(null);
		port = Integer.parseInt(ReadConfig.GET("PORT"));
		server=new Server(port);
	}
	
	public void sendMessage(String msg)
	{
		server.sendMessage(msg);
	}
	private void startListening()
	{
		server.startServer();
	}
	
	public void stopListening()
	{
		server.stopServer();
	}

	public void run() {
		// TODO Auto-generated method stub
		startListening();
	}
}
